/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package biofilter.sources;

import biofilter.exceptions.InvalidRecordException;
import biofilter.records.Record;

/**
 *
 * @author t9i
 */
public interface RecordsSourceIF {

    /**
     * To indicate whether the filter has processed all incoming records and returned all of its output.
     * @return boolean - true if all records have been processed, false otherwise
     */
    boolean eof();

    /**
     * To cause descendant classes to implement a standard getRecord method which will
     * be used according to the pipes and filters architecture pattern.
     * @return Record - the next record
     */
    Record getRecord() throws InvalidRecordException;

    /**
     * To get the next Record to be processed. This is what will be returned by the next call
     * to getRecord(). This is a default non-implementation.  It just throws and exception if
     * this gets called and has not been implemented in the descendant.
     * @return Record - the next record in the queue
     */
    Record peek() throws InvalidRecordException;

    /**
     * To reset the source of this records file. It will set the pointer back to the
     * beginning of the file or records array.  Filters will reset their own source.
     */
    void resetSource() throws IllegalArgumentException;

    /**
     * To set the source of this records file. Can be one of two types for a concrete source:
     * String (filename) or Record[].  For a filter, the source must be a RecordsSourceBase.
     */
    void setSource(Object source) throws IllegalArgumentException;

}
